<template>
  <div class="radar-echart" ref="myDiv"></div>
</template>

<script>
// 完成加载过程
// import echarts from 'echarts'
// import * as echarts from "echarts";
var echarts = require("echarts");
var echarts = require("echarts/lib/echarts"); // 引入echarts主模块
require("echarts/lib/chart/radar"); // 引入雷达图
// import { RadarChart } from "echarts/charts";
// // 引入提示框和标题组件
require("echarts/lib/component/tooltip");
require("echarts/lib/component/title");
export default {
  mounted() {
    var myChart = echarts.init(this.$refs.myDiv);

    // 指定图表的配置项和数据
    var option = {
      title: {
        text: "基础雷达图",
      },
      legend: {
        data: ["预算分配", "实际开销"],
      },
      radar: {
        // shape: 'circle',
        indicator: [
          { name: "工作效率", max: 100 },
          { name: "考勤", max: 100 },
          { name: "积极性", max: 100 },
          { name: "帮助同事", max: 100 },
          { name: "自主学习", max: 100 },
          { name: "正确率", max: 100 },
        ],
      },
      series: [
        {
          name: "预算 vs 开销(Budget vs spending)",
          type: "radar",
          // areaStyle: {normal: {}},
          data: [
            {
              value: [10, 1, 100, 5, 100, 0],
              name: "张三",
            },
            {
              value: [50, 50, 50, 50, 50, 10],
              name: "李四",
            },
          ],
        },
      ],
    };

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
  },
};
</script>

<style scoped>
.radar-echart {
  width: 600px;
  height: 400px;
}
</style>
